function validateForm(){
	var oForm=document.forms["account"];
	var oUsername=oForm["Name"];
	var oPassword=oForm["loginPwd"];
	var oPassword2=oForm["password2"];
	var reName=/^(\w){6,20}$/;
	var rePassword=/[A-Za-z].*[0-9]|[0-9].*[A-Za-z]/;
	if (oUsername.value==""){
		oUsername.parentNode.getElementsByTagName("p")[0].style.display="block";
		oUsername.focus();
		return false;
	}else if (!reName.test(oUsername.value)){
		oUsername.parentNode.getElementsByTagName("p")[0].style.display="none";
		oUsername.parentNode.getElementsByTagName("p")[1].style.display="block";
		oUsername.focus();
		return false;
	}
	else{
		oUsername.parentNode.getElementsByTagName("p")[0].style.display="none";
	}
		

	if (oPassword.value==""){
		oPassword.parentNode.getElementsByTagName("p")[0].style.display="block";
		oPassword.focus();
		return false;
	}else if (!rePassword.test(oPassword.value)){
		oPassword.parentNode.getElementsByTagName("p")[0].style.display="none";
		oPassword.parentNode.getElementsByTagName("p")[1].style.display="block";
		oPassword.focus();
		return false;
	}
	else
		oPassword.parentNode.getElementsByTagName("p")[0].style.display="none";
		

	if (oPassword2.value==""){
		oPassword2.parentNode.getElementsByTagName("p")[0].style.display="block";
		oPassword2.focus();
		return false;
	}
	else if (oPassword.value!=oPassword2.value){
		oPassword2.parentNode.getElementsByTagName("p")[0].style.display="none";
		oPassword2.parentNode.getElementsByTagName("p")[1].style.display="block";
		oPassword2.focus();
		return false;
	}
	else{
		oPassword2.parentNode.getElementsByTagName("p")[0].style.display="none";
		oPassword2.parentNode.getElementsByTagName("p")[1].style.display="none";
	}

	var oGenders=document.getElementsByName("gender");
	var bChecked=false;
	for (var i=0;i<oGenders.length;i++)
		if (oGenders[i].checked) {
			bChecked=true;
			break;
		}		
	if (!bChecked){
		oGenders[0].parentNode.parentNode.getElementsByTagName("li")[2].style.display="block";
		return false;
	}
	else
		oGenders[0].parentNode.parentNode.getElementsByTagName("li")[2].style.display="none";
}
function init(){
	document.forms["account"].onsubmit=validateForm;
}
window.onload=init;
		
	